package com.viethp.mt.objects;

import org.ksoap2.serialization.SoapObject;

public class User {
	private static final String XML_ID = "id";
	private static final String XML_USERNAME = "username";
	private static final String XML_EMAIL = "email";
	private static final String XML_PHONE = "phone";
	private static final String XML_PASSWORD = "password";
	private int id;
	private String username;
	private String email;
	private String phone;
	private String passWord;

	public User(SoapObject user) {
		if (user != null && user.hasProperty(XML_ID)) {
			this.id = Integer.parseInt(user.getProperty(XML_ID).toString());
			this.username = user.getProperty(XML_USERNAME).toString();
			this.email = user.getProperty(XML_EMAIL).toString();
			this.phone = user.getProperty(XML_PHONE).toString();
			if (user.hasProperty(XML_PASSWORD)) {
				Object passWordObj = user.getProperty(XML_PASSWORD);
				if (passWordObj != null) {
					this.passWord = user.getProperty(XML_PASSWORD).toString();
				}
			}
		}
	}

	public User() {
	}

	public String getUserName() {
		return this.username;
	}

	public void setUserName(String username) {
		this.username = username;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}
}
